import * as actionType from './constants';

 
 const changeDeleteAction = (res) => ({
   type: actionType.CHANGE_DELETE_TODOLIST,
   todolist: res
 });

  const changeIsCompleteAction = (res) => ({
    type: actionType.CHANGE_IS_COMPLETE_TODOLIST,
    todolist: res
  });

  const changeEditAction = (res) => ({
    type: actionType.CHANGE_Edit_TODOLIST,
    todolist: res
  });

  const changeAddAction = (res) => ({
    type: actionType.CHANGE_ADD_TODOLIST,
    todolist: res
  });
 
   const changeSearchAction = (code) => ({
     type: actionType.CHANGE_SEASRCH_TODOLIST,
      code
   });

// todoList 的删除
 export const getDeleteAction = (resule) => {
   return (dispatch)=>{
     dispatch(changeDeleteAction(resule));
   }
 };

//  修改状态
 export const getisCompleteAction = (resule) => {
   return (dispatch) => {
     dispatch(changeIsCompleteAction(resule));
   };
 };

 //  提交修改后的内容
 export const getEditAction = (resule) => {
   return (dispatch) => {
     dispatch(changeEditAction(resule));
   };
 };

  //  添加内容
 export const getAddAction = (resule) => {
   return (dispatch) => {
     dispatch(changeAddAction(resule));
   };
 };

//  搜索

export const getSearchAction = (code)=>{
  return (dispatch)=>{
    dispatch(changeSearchAction(code));
  }
}